package br.com.br1.fv.mobile.activity;

import org.droidsql.DBHelpper;

import br.com.br1.fv.db.DBInitializer;
import br.com.br1.fv.mobile.FlowControl;
import br.com.br1.fv.mobile.R;
import br.com.br1.fv.mobile.R.id;
import br.com.br1.fv.mobile.R.layout;
import br.com.br1.fv.mobile.R.menu;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		DBHelpper.initSingleton(this, new DBInitializer());
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
	
	public void listarClientes(View v){

		Intent intent = new Intent().setClass(this, ListaClientesActivity.class);

		if(v.getId() == R.id.btnRealizarVenda){
			FlowControl fc = new FlowControl();
			fc.addLevel(ListaClientesActivity.class, ClienteActivity.class);
			fc.addLevel(DetalhesPedidoActivity.class);
			fc.addLevel(PedidoActivity.class);
			fc.registry(intent);
		}
		

		startActivity(intent);
	}

}
